package com.zhijian.medical.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.zhijian.response.annotation.Response;
import com.zhijian.util.page.Page;

import com.zhijian.medical.entity.po.CnasNewCorrectiveExcel;
import com.zhijian.medical.service.CnasNewCorrectiveExcelService;
import com.zhijian.medical.entity.vo.request.CnasNewCorrectiveExcelSearchVo;
import com.zhijian.medical.entity.vo.request.CnasNewCorrectiveExcelSaveOrUpdateVo;
import com.zhijian.medical.entity.vo.response.CnasNewCorrectiveExcelVo;

import lombok.extern.slf4j.Slf4j;
import java.util.List;

/**
 * cnas不符合项表格 控制层
 * 
 * @author auto
 * @version 1.0
 * @date 2025-06-19 09:33:18
 */
@Slf4j
@Controller
@Api(tags = "cnas不符合项表格")
public class CnasNewCorrectiveExcelController {

	@Autowired
    private CnasNewCorrectiveExcelService service;
    
    /**
     * 新增
     *
     * @param param
     * @return
     */
    @Response
    @PostMapping("/cnas/new/corrective/excel")
    @ApiOperation("新增")
    public boolean insert(@RequestBody CnasNewCorrectiveExcelSaveOrUpdateVo param) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), param);
        return service.save(param);
    }

    /**
     * 修改
     *
     * @param id
     * @param param
     * @return
     */
    @Response
    @PutMapping("/cnas/new/corrective/excel/{id}")
    @ApiOperation("修改")
    public boolean update(@PathVariable("id") Long id, @RequestBody CnasNewCorrectiveExcelSaveOrUpdateVo param) {
        log.info("{} - {}| update info, {}", this.getClass().getSimpleName(), id, param);
        param.setId(id);
        return service.modify(param);
    }

    /**
     * 根据id查询
     *
     * @param id
     * @return
     */
    @Response
    @GetMapping("/cnas/new/corrective/excel/{id}/{sopType}")
    @ApiOperation("根据cnsa的id查询")
    public CnasNewCorrectiveExcelVo selectById(@PathVariable("id") Long id, @PathVariable("sopType") Byte sopType) {
        log.info("{} - {}| query info", this.getClass().getSimpleName(), id);
        return service.selectOne(CnasNewCorrectiveExcelSearchVo.builder().cnasId(id).sopType(sopType).build());
    }

}